package org.wx.io.netty.rpc.dispatcher;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @description: 请求处理的分发者
 * 在内部存储接口的单例实现类
 * @author: wangxun
 * @createDate: 2021/2/23
 * @version: 1.0
 */
public class Dispatcher {
    // 私有构造器，单例模式
    private Dispatcher(){

    }

    private static Dispatcher dispatcher;
    static {
        dispatcher = new Dispatcher();
    }

    public static Dispatcher getDispatcher(){
        return dispatcher;
    }
    public static ConcurrentHashMap<String,Object> invokeMap = new ConcurrentHashMap<>();

    public void register(String name,Object o){
        invokeMap.put(name, o);
    }

    public Object get(String name){
       return invokeMap.get(name);
    }


}
